package com.billion.payment.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * @author 王琦
 * @date 2022/1/14
 */
@Component
@ConfigurationProperties(prefix = "payment.alipay")
@PropertySource(value = { "classpath:payment.yml" })
public class AlipayConfig {

    //沙箱环境https://openapi.alipaydev.com/gateway.do
    //正式环境https://openapi.alipay.com/gateway.do
    public static String GATEWAY_URL = "https://openapi.alipay.com/gateway.do";

    /** 订单失效时间, 单位：秒 **/
    public static String TIMEOUT_EXPRESS = "2m";

    /** 格式化类型 **/
    public static String FORMAT = "json";

    /** 编码格式 **/
    public static String CHARSET = "UTF-8";

    /** 签名格式 */
    public static String SIGN_TYPE = "RSA2";

    /** 回调地址 **/
    private static String notifyUrl;

    public static String getNotifyUrl() {
        return notifyUrl;
    }

    @Value("${ali_notifyUrl}")
    public static void setNotifyUrl(String notifyUrl) {
        AlipayConfig.notifyUrl = notifyUrl;
    }
}
